using System.Diagnostics.CodeAnalysis;
using Digitalmes.Domain.SeedWork;
using SqlSugar;
using SqlSugar.DbConvert;

namespace Digitalmes.Infrastructure.IntegrationTests.Models;

/// <summary>
/// 贡献人
/// </summary>
/// <remarks>
/// MySQL: 
/// <code>
/// DROP TABLE IF EXISTS `contributor`;
/// CREATE TABLE `contributor` (
///   `Id` 					    bigint(20) NOT NULL COMMENT 'Id',
///   `Name`			      varchar(64) NOT NULL COMMENT '名称',
///   `Email`					  varchar(64) DEFAULT NULL COMMENT '电话',
///   `Projects`		    JSON DEFAULT NULL COMMENT '共享项目集合',
///   `Source` 				  varchar(32) NOT NULL COMMENT '贡献者来源',
///   `Status` 				  int NOT NULL DEFAULT 1 COMMENT '状态',
///   `IsDeleted` 			tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
///   `CreatedBy`			  varchar(64) DEFAULT NULL COMMENT '创建人',
///   `CreatedTime` 		datetime NOT NULL COMMENT '创建时间',
///   `UpdatedBy` 			varchar(64) DEFAULT NULL COMMENT '修改人',
///   `UpdatedTime` 		datetime DEFAULT NULL COMMENT '修改时间',
///   PRIMARY KEY(`Id`)
/// ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT = DYNAMIC COMMENT='贡献者表';
/// </code>
/// </remarks>
[SugarTable("contributor")]
public sealed class Contributor : AuditedEntity, ISoftDelete
{
    [NotNull]
    public string? Name { get; set; }

    public string? Email { get; set; }

    [SugarColumn(IsJson = true)]
    public string[]? Projects { get; set; }

    [SugarColumn(SqlParameterDbType = typeof(EnumToStringConvert))]
    public ContributorSource Source { get; set; }

    public StatusEnum Status { get; set; }

    public bool IsDeleted { get; set; }
}
